package com.easyssh.framework.web.listener;

import javax.servlet.ServletContext;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class SpringBeanManager {
	private static WebApplicationContext context;
	
	public static void initContext(ServletContext sc) {
		context = WebApplicationContextUtils.getWebApplicationContext(sc);
	}

	public static Object getBean(String name) {
		return context.getBean(name);
	}

	public static <T> T getBean(Class<T> clazz) {
		return context.getBean(clazz);
	}
}
